home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!austern
- From: tim@franck.Princeton.EDU (Tim Hollebeek)
- Newsgroups: comp.std.c++
- Subject: Re: Single-line comment and line continuation
- Date: 05 Mar 1996 09:41:20 PST
- Organization: Princeton University
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <4hgbpd$1pl@cnn.Princeton.EDU>
- References: <313B3175.331A@strata3d.com> <4hffkm$3f0@engnews1.Eng.Sun.COM>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: 5 Mar 1996 03:18:05 GMT
- X-Newsreader: TIN [version 1.2 PL2]
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMTx80Uy4NqrwXLNJAQFgWwH+IfWwJOF8iCkijHePQaoeC0/FnL4h3wfL
- ZEyqEzYpesxeYm3fMBFgR15wWCH/Bbsf/no0nCLZytDtNz9I/pFnOg==
- =vWpx
- Originator: austern@isolde.mti.sgi.com
-
- Steve Clamage (clamage@Eng.Sun.COM) wrote:
- : >I just ran across something in my C++ compiler dealing with single line
- : >comments and the line continuation token:
- : >
- : > if ((ch[0] == '\\') && (ch[1] == '\\')) //look for initial \\
- : >
- : >This, under my compiler implementation will choke because of the line
- : >continuation token, '\' at the end of the comment.
-
- : In C++, simply don't use '//' comments on any line that ends with an
- : escaped newline (including macro definitions!). In your example, it would
- : make the comment more readable IMHO if you put the '\\' in quotes anyway,
- : and would eliminate the problem.
-
- Or simply add a single space after the last \, and take advantage of
- that annoying behavior for once :-)
-
- ---------------------------------------------------------------------------
- Tim Hollebeek | Disclaimer :=> Everything above is a true statement,
- Electron Psychologist | for sufficiently false values of true.
- Princeton University | email: tim@wfn-shop.princeton.edu
- ----------------------| http://wfn-shop.princeton.edu/~tim (NEW! IMPROVED!)
- ---
- [ comp.std.c++ is moderated. To submit articles: Try just posting with your
- newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
- comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
- Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu
- ]
-